package lc_2437_有效时间的数目;


public class Solution {
    public int countTime(String time) {
        int hour = 0, minute = 0;
        int a = time.charAt(0), b = time.charAt(1), c = time.charAt(3), d = time.charAt(4);
        for (int i = 0; i < 24; i++) {
            int x = i / 10, y = i % 10;
            if ((a == '?' || a == x + '0') && (b == '?' || b == y + '0')) {
                hour++;
            }
        }
        for (int i = 0; i < 60; i++) {
            int x = i / 10, y = i % 10;
            if ((c == '?' || c == x + '0') && (d == '?' || d == y + '0')) {
                minute++;
            }
        }
        return hour * minute;
    }

    public static void main(String[] args) {
        Solution so = new Solution();
        int ans1 = so.countTime("?5:00");
        System.out.println(ans1);
        System.out.println(so.countTime("0?:0?"));
        System.out.println(so.countTime("??:??"));
    }
}